﻿using PeaceBlogData;
using PeaceBlogData.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;

namespace PeaceBlog.Controllers.API
{
    public class TagsController : ApiController
    {
        private PeaceBlogEntity db = new PeaceBlogEntity();

        [HttpGet]
        public async Task<List<Tags>> GetAllTags()
        {
            return await db.GetAllTagsAsync();
        }

        [HttpGet]
        public async Task<Tags> GetTag(string Id)
        {
            return await db.GetTag(Id);
        }

        [HttpGet]
        public List<Posts> GetPostsFromTag(string Id)
        {
            return db.GetPostsFromTag(Id);
        }
    }
}
